#!/bin/sh

if [ "$SSO_ENV" == "PROD" ] ; then
    SSO_JAR="sso-uniportal-axis-pro0.1.jar"
else
    SSO_JAR="sso-uniportal-axis-uat01.jar"
fi;

CLASSPATH="hw-translate.jar"

# Spring Boot uses LOADER_PATH to specify external classpath. It must be used with PropertiesLauncher
LOADER_PATH="./resources,lib/$SSO_JAR"

MAIN_CLASS="org.springframework.boot.loader.PropertiesLauncher"
JAVA_CMD=java

cat resources/config/CommonService.properties.template | envsubst > resources/config/CommonService.properties && LOADER_PATH=$LOADER_PATH $JAVA_CMD -classpath "$CLASSPATH" $MAIN_CLASS
